package lanou3g.com.Activity;


import android.os.Build;
import android.os.Bundle;
import android.support.design.widget.TabLayout;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.view.WindowManager;

import lanou3g.com.adapter.Welcome_Adapter;

/**
 * Created by dllo on 2015/10/23.
 */
public class Welcome_Activity extends AppCompatActivity {
    private ViewPager viewPager;
    private TabLayout tabLayout;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

       setContentView(R.layout.activity_welcome);
        //判断当前SDK版本号，如果是4.4以上，就是支持沉浸式状态栏的
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
            //透明状态栏
            getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
            //透明导航0栏
            getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
        }
        initView();
        initData();
    }

    private void initData() {
            Welcome_Adapter adapter = new Welcome_Adapter(getSupportFragmentManager());
            viewPager.setAdapter(adapter);
            //TabLayout和viewPager进行绑定
            tabLayout.setupWithViewPager(viewPager);



    }

    private void initView() {
        viewPager = (ViewPager) findViewById(R.id.viewPager);
        tabLayout = (TabLayout) findViewById(R.id .tabLayout);
        //设置TabLayout科滑动模式
        tabLayout.setTabMode(TabLayout.MODE_SCROLLABLE);
        //设置颜色
        tabLayout.setSelectedTabIndicatorColor(0xff0088ff);
    }


}
